import { ref, computed } from "vue";
import { useRouter } from "vue-router";
const useCommuniction = () => {
  const isShow = ref<number>(0);
  const infoAttr = ref<String[]>(["系统通知", "互动通知", "订单通知"]);
  const router = useRouter(); //得到路由实例
  const toSystemNote = () => {
    isShow.value = 0;
    router.push({
      name: "SystemNote",
    });
  };
  const toOrderNote = () => {
    isShow.value = 2;
    router.push({
      name: "OrderNote",
    });
  };
  const toInteractNote = () => {
    isShow.value = 1;
    router.push({
      name: "InteractNote",
    });
  };
  const info = computed(() => {
    return infoAttr.value[isShow.value];
  });
  /*--------------------  暴露数据  ---------------------------------*/
  return { info, toSystemNote, toOrderNote, toInteractNote };
};
export default useCommuniction;
